/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import engine.ApplicationManager;
import java.awt.CardLayout;
import javax.swing.JFrame;

/**
 *
 */
public class GUIManager {

    private final MainFrame mainFrame;
    private final LoginPanel loginPanel;
    private final String loginPanelString;
    private static GUIManager INSTANCE;

    public GUIManager() {

        mainFrame = new MainFrame();
        loginPanel = new LoginPanel();
        loginPanelString = "LoginPanelString";
        this.initializeGUI();
        INSTANCE = this;
    }

    public static GUIManager getInstance() {

        return INSTANCE;
    }

    private void initializeGUI() {

        CardLayout layout = new CardLayout();
        mainFrame.setLayout(layout);
        mainFrame.add(loginPanelString, loginPanel);
        mainFrame.setVisible(true);
    }

    /**
     * @return the mainFrame
     */
    public MainFrame getMainFrame() {
        return mainFrame;
    }

    /**
     * @return the loginPanel
     */
    public LoginPanel getLoginPanel() {
        return loginPanel;
    }

    /**
     *
     * @param userName
     * @param password
     */
    public void loginAction(String userName, String password) {

        ApplicationManager.getInstance().login(userName, password);
    }
}
